home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / abuse / net / test.c < prev   
C/C++ Source or Header  |  1995-09-18  |  401b  |  22 lines

  1. #include <sys/types.h>
  2. #include <sys/socket.h>
  3. #include <netinet/in.h>
  4. #include <netdb.h>
  5.  
  6. main(int argc, char **argv)
  7. {
  8.   struct hostent *hn=gethostbyname(argv[1]);
  9.   if (hn)
  10.   {
  11.     printf("host %s\n",hn->h_name);
  12.     char **a=hn->h_addr_list;
  13.     while (*a)
  14.     {
  15.       char *b=*a;
  16.       printf("address %d.%d.%d.%d\n",b[0],b[1],b[2],b[3]);
  17.       a++;
  18.     }
  19.   }
  20.             
  21. }
  22.